{extend name="public:base" /}

{block name="style"}
<link rel="stylesheet" type="text/css" href="__INDEX__/css/public.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/responsive.css">
<link rel="shortcut icon" href="__INDEX__/images/favorite.ico">
<style>
.num_type{display: inline-block;width: 20px;text-align: center;height: 20px;/*line-height: 20px;*/border:1px solid #ddd;cursor: pointer;vertical-align: middle;}
</style>
{/block}
{block name="html"}
{include file="index@public/main" /}
<form method="post" action="{:url('Depot/ti_order')}">
<div class="right_style">
	<h3 class="title_style"><em></em><span>云仓</span></h3>
	<div id="yuncang_tihuo">
		<div class="pro">
			<p class="title">{$data['type'] == 1?'会员云仓':'代理云仓'}</p>
			<p class="name">余额:{$data['money']}</p>
			<p class="name">剩余:{$data['num']}套</p>
			<p class="num-p">数量：
				<a javascritp:; class="jian num_type">-</a><input name="goods_num" style="width: 40px" class="num num_type" value="1"><a href="javascript:;" class="jia num_type">+</a>
			</p>
		</div>
		<input type="hidden" name="id" value="{$data['id']}">
		<input type="hidden" name="goods_id" value="{$goods['id']}">
		<input type="hidden" name="goods_price" value="{$goods['price']}">
		<input type="hidden" id="url" value="{:url('Depot/adderss_list')}">
		{if condition="$address"}
		<ul class="add-ul choose">
			<input type="hidden" name="address_id" value="{$address['id']}">
			<li>
				<p style="">收货人:<span>{$address['name']}</span> <span>{$address['phone']}</span></p>
				<p>
					<a href="">{$address['address']}</a>
				</p>
			</li>
		</ul>
		{else /}
		<input type="hidden" name="address_id" value="">
		<p class="choose">选择收货地址</p>
		{/if}
		<a href="javascript:;" class="submit">提交</a>
	</div>
</div>
<form>
{/block}

{block name="javascript"}
<script type="text/javascript" src="__INDEX__/js/jquery.flexslider-min.js"></script>
<script src="__INDEX__/js/jquery-1.9.1.min.js"></script>
<script src="__INDEX__/js/public.js"></script>
<script src="__INDEX__/layer/layer.js"></script>
<script>
	var num = {$data.num};
	//加减
	$(".jia").click(function() {
		if(parseInt($(".num").val()) >= num) {
			$(".num").val(num)
			zdalert("消息", "不能超出剩余套数"); //弹出框("不得小于0")
		} else {
			$(".num").val(parseInt($(".num").val()) + 1);
		}
	})
	$(".jian").click(function() {
		if(parseInt($(".num").val()) <= 1) {
			$(".num").val(1)
			zdalert("消息", "不得小于0"); //弹出框("不得小于0")
		} else {
			$(".num").val(parseInt($(".num").val()) - 1);
		}
	})
	$(".num").change(function(){
		if(parseInt($(".num").val()) < 1){
			$(".num").val(1);
		}else if(parseInt($(".num").val()) > num){
			$(".num").val(num);
		}
	})

	$(".submit").click(function(){
		var address_id = $("input[name='address_id']").val();
		if(address_id==null){
            layer.msg("请选择收货地址");
            return false;
        }
		$('form').submit();
	})



</script>

<script>
	if($(".add-ul li").length <= 0) {
		$(".no_record").show();
	} else {
		$(".no_record").hide();
	}

	var w = $(document).width();
	if(w >= 500) {
		w = 600;
	} else if(w <= 480) {
		w = 375;
	}
	//弹出地址
	$('.choose').on('click', function() {
        layer.open({
			type: 2,
			title: '提货地址',
			maxmin: true,
			shadeClose: true, //点击遮罩关闭层
			area: [w * 0.9 + "px", '450px'],
			content: ['/index/Depot/dzlist'],
		});

	});
	
</script>

{/block}